package com.itheima.service.impl;

import com.itheima.mapper.DeptMapper;
import com.itheima.pojo.Dept;
import com.itheima.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    DeptMapper dm;
    @Override
    public List<Dept> findall(){
       return dm.findal();
    }

    @Override
    public void deletone(Integer idd) {
        dm.deleteon(idd);
    }
    @Override
    public void insertone(Dept d) {
        d.setCreateTime(LocalDateTime.now());
        d.setUpdateTime(LocalDateTime.now());
        dm.inserton(d);
    }

    @Override
    public Dept getone(Integer id) {
        return dm.geton(id);
    }

    @Override
    public void changeone(Dept d) {
        d.setUpdateTime(LocalDateTime.now());
        dm.changeon(d);
    }

}
